package com.atstudent.gmall.product.controller;

import com.atstudent.gmall.common.result.Result;
import com.atstudent.gmall.common.result.ResultCodeEnum;
import com.atstudent.gmall.product.entity.SpuImage;
import com.atstudent.gmall.product.service.SpuImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * spu下的图片
 * @Author 薛有朋
 * @CreatDate 2024/11/25 21:38
 **/
@RestController
@RequestMapping(value = "/admin/product")
public class SpuImageController {

    @Autowired
    private SpuImageService spuImageService;

    /**
     * 根据spuId获取图片列表
     * @Author 薛有朋
     * @Date 2024/11/25 21:39
     **/
    @GetMapping(value = "/spuImageList/{spuId}")
    public Result<List<SpuImage>> findBySpuId(@PathVariable(value = "spuId") Long spuId){
        List<SpuImage> spuImageList = spuImageService.findBySpuId(spuId);
        return Result.ok(spuImageList);
    }
}
